package com.arron.test;

import java.util.Calendar;

public class Main {
    public static void main(String[] args) {
        AbstractFactory colorFactory1 = FactoryProducer.getFactory("COLOR");
        Color color1 = colorFactory1.getColor("RED");
        color1.fill();
        Color color2 = colorFactory1.getColor("GREEN");
        color2.fill();
        Color color3 = colorFactory1.getColor("BLUE");
        color3.fill();

        AbstractFactory shapeFactory = FactoryProducer.getFactory("SHAPE");
        Shape shape1 = shapeFactory.getShape("RECTANGLE");
        shape1.draw();
        Shape shape2 = shapeFactory.getShape("CIRCLE");
        shape2.draw();
        Shape shape3 = shapeFactory.getShape("SQUARE");
        shape3.draw();

        //Runtime 饿汉式 单例模式使用
        Runtime runtime = Runtime.getRuntime();
        System.out.println(runtime);
        //Calendar，简单工厂模式 源码实现
        Calendar calendar =Calendar.getInstance();


    }
}
